function BlockGrid(ctx, layout) {
    this.blocks = [];
    this.layout = layout;
    this.cols = layout[0].length;
    this.rows = layout.length;
    this.padding = 50;
}

BlockGrid.prototype.init = function() {

    for(var i = 0; i < this.rows; i++) {
        for(var j = 0; j < this.cols; j++) {
            console.log(this.layout[i][j], "j: ", j, "i: ", i);
            if(this.layout[i][j] === 1) {
                var startX = j * 50 + this.padding;
                var startY = i * 20 + this.padding;
                var block = new Block(ctx, startX, startY);
                this.blocks.push(block);
            } 
        }
    }
};

BlockGrid.prototype.draw = function() {
    for(var i = 0; i < this.blocks.length; i++) {
        this.blocks[i].draw();
    }
};

BlockGrid.prototype.solveCollision = function(ball) {
    for(var i = 0; i < this.blocks.length; i++) {
        this.blocks[i].solveCollision(ball);
    }
};